//
//  SafeAreaTestViewController.m
//  MyDemos
//
//  Created by iMac on 2018/3/15.
//  Copyright © 2018年 iMac. All rights reserved.
//

#import "SafeAreaTestViewController.h"
#import "UIButton+WDExtention.h"
#import "UIView+WDExtention.h"
#import "TestSafeArea222ViewController.h"



@interface SafeAreaTestViewController ()

@end

@implementation SafeAreaTestViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.view.sBGColor([UIColor whiteColor]);
    [self addDismissButton];
    
    UIButton *btn = Button().sNomalTitleColor(@"点击", [UIColor redColor]).sFrame(CGRectMake(100 ,100, 100, 100));
    
    [btn tap:^(UIButton * _Nonnull sender) {
        TestSafeArea222ViewController *tes = [[TestSafeArea222ViewController alloc] init];
        UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:tes];
        UITabBarController *tab = [[UITabBarController alloc] init];
        [tab addChildViewController:nav];
        [self presentViewController:tab animated:YES completion:nil];
    }];
    self.view.aSubView(btn);
    
}


- (void)addDismissButton {
    UIButton *dismiss = ({
        UIButton *btn = [[UIButton alloc] init];
        [btn setTitle:@"dismiss" forState:UIControlStateNormal];
        [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        CGFloat f = 100;
        btn.frame = CGRectMake(SCREEN_WIDTH - f, SCREEN_HEIGHT - f, f, f);
        [btn setBackgroundColor:[UIColor purpleColor]];
        [btn addTarget:self action:@selector(dismissButtonClick:) forControlEvents:UIControlEventTouchUpInside];
        btn;
    });
    [[UIApplication sharedApplication].delegate.window addSubview:dismiss];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
